package hlhj.fhp.burst.adapter

import android.support.v7.widget.GridLayoutManager
import android.widget.RelativeLayout
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import hlhj.fhp.burst.GlideUtil
import hlhj.fhp.burst.R

/**
 * Created by Never Fear   on 2019\1\28 0028.
Never More....
 */
class NineGridAdp(private val dats:ArrayList<String>) :BaseQuickAdapter<String,BaseViewHolder>(R.layout.nine_item_burst,dats) {
    override fun convert(helper: BaseViewHolder?, item: String?) {
        GlideUtil.loadImg(mContext,item?.replace("\\","/"),helper?.getView(R.id.itemImg))
        val layout = helper?.itemView as RelativeLayout
        val params = layout.layoutParams as GridLayoutManager.LayoutParams
        when(helper?.adapterPosition%3){
            0->{
                params.setMargins(0,0,5,10)
            }
            1->{
                params.setMargins(5,0,5,10)
            }
            2->{
                params.setMargins(5,0,0,10)
            }
        }
        layout.layoutParams=params
    }
}